home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Windows News 2010 Summer - Disc 1
/
WN_Ete2010_CD1.iso
/
Onglet5
/
Weezo
/
Weezo setup.exe
/
{code_appDir}
/
www
/
local
/
displayResource.php
< prev
next >
Wrap
PHP Script
|
2010-05-19
|
2KB
|
72 lines
<?php
/**
* Open a resource in an application window, without login with an user (so far only used by chat resource)
*
* PHP version 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_0.txt. If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to license@php.net so we can mail you a copy immediately.
*
* @category NA
* @package NA
* @author Nicolas Bruley / Peer 2 World <contact@weezo.net>
* @copyright 2005-2009 Nicolas Bruley / Peer 2 World
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id:$
* @link http://www.weezo.net
* @since File available since Release 1.0.4
*/
// Note: should be removed as UI works with sessions since V2.0
/**
* @desc Save session data
*
*/
function saveDisplayResourceSession(){file_put_contents(cfAppDataDir().'/sessiondata/DisplayResourceSession',serialize($_SESSION));}
// Use dedicated session data so it's not closed by other application-called resources
$_SESSION=(file_exists(cfAppDataDir().'/sessiondata/DisplayResourceSession'))?unserialize(file_get_contents(cfAppDataDir().'/sessiondata/DisplayResourceSession')):array();
register_shutdown_function('saveDisplayResourceSession');
// Initialize script data
require_once('localFunctions.php');
lfInit();
// First load
if(!isset($_SESSION['activeResourceId'])){
echo '<body onload="document.location.href=\''.$_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING'].'\'"></body>';
$_SESSION['activeResourceId']=0;
exit;
}
if (!isset($_GET['resourceConfigFile']) && !isset($_SESSION['res'][0])) {
wSession_destroy(); die('no resource configuration file');
}
// Load resource configuration file
if(!isset($_SESSION['res'][0])){
$res=new WResConfig($_GET['resourceConfigFile']);
if(!$res->isValid()) die('Resource '.$_GET['resourceConfigFile'].' not found');
$_SESSION['res'][0]=$res->getVar();
// Set minimal user data
cfUSetVar('icon','default.jpg');
cfUSetVar('id','applicationUser');
cfUSetVar('administrator',true);
}
else $res=new WResConfig($_SESSION['res'][0]['id']);
// Set PHP_SELF on target script
$_SERVER['APPLICATION_PHP_SELF']=$res->definition('resourceScriptPath').'/'.$res->definition('baseFile');
// Require resource script
require(cfAppDocRoot().$_SERVER['APPLICATION_PHP_SELF']);
?>